<template>
  <div class="full-screen-container">
    <div
      class="background-image"
      v-if="language === 'china'"
      :style="{ backgroundImage: 'url(' + backgroundImage + ')' }"
    >
      <div class="top-right-text">
        <el-progress
          :percentage="displaytime"
          :stroke-width="6"
           :show-text =true
          color="rgb(57,156,179)"
         text-color="rgb(57,156,179)"
        > <div slot="text" class="custom-progress-text">&nbsp;&nbsp;{{ displaytime }}%</div></el-progress>
      </div>
    </div>
    <div
      class="background-image"
      v-if="language === 'en'"
      :style="{ backgroundImage: 'url(' + enImage + ')' }"
    >
      <div class="top-right-text">
        <el-progress
          :percentage="displaytime"
          :stroke-width="6"
           :show-text =true
          color="rgb(57,156,179)"
       text-color="rgb(57,156,179)"

        ><div slot="text" class="custom-progress-text"> &nbsp;&nbsp;{{ displaytime }}%</div></el-progress>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "FullScreenProgress",
  data() {
    return {
      displaytime: 0,
      language: "",
      customColors: "rgb(33,175,187)",
      progress: 0,
      backgroundImage: require("../../img/chinesetop.jpg"),
      enImage: require("../../img/entop.jpg"),
    };
  },
  mounted() {
    this.language = localStorage.getItem("language");
    this.startProgress();
  },
  methods: {
    // 设置一个定时器，三秒倒计时
    startProgress() {
      setInterval(() => {
        if(this.displaytime <=100)
        this.displaytime+= 2;
      }, 60);
    },
  },
};
</script>
<style lang="scss">
.el-progress__text {
  color: #ffffff;
}

/deep/.el-progress-bar__outer {
  background-color: rgb(19, 23, 48);
}

/deep/.el-progress__text {
  min-width: 10px;
  font-size: 10px;
  color: #7b90b8;
}

/deep/.el-progress__text span {
  font-size: 10px;
}
</style>
<style scoped>
.full-screen-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.background-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.progress-wrapper {
  z-index: 1;
}

.top-right-text {
  display: block; /* 使margin: auto;有效 */
  width: 300px; /* 根据需要调整div的宽度 */
  margin-left:42%; /* 使div在水平方向上居中 */
  font-size: 10px;
  padding-top: 40%;
}
.custom-progress-text{
  color: rgb(33,175,187);
  font-size: 11px;
}
</style>